/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.ar.entity;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.modules.base.entity.cars.Tcar;
import com.jeesite.modules.base.entity.customer.Customer;
import com.jeesite.modules.base.entity.fixedexpense.FixedExpense;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 应收单Entity
 * @author YY
 * @version 2021-03-12
 */
@Table(name="t_ar_detail", alias="a", columns={
		@Column(name="ar_detail_id", attrName="arDetailId", label="应收单明细ID", isPK=true),
		@Column(name="brand", attrName="brand", label="品牌"),
		@Column(name="area", attrName="area", label="版型"),
		@Column(name="model", attrName="model", label="车型"),
		@Column(name="car_id", attrName="carId", label="车辆"),
		@Column(name="frame_number", attrName="frameNumber", label="车架号"),
		@Column(name="expense_item", attrName="expenseItem", label="费用项目"),
		@Column(name="rei_left", attrName="reiLeft", label="剩余应收"),
		@Column(name="ap_amount", attrName="apAmount", label="应收金额", comment="应收金额（人民币）"),
		@Column(name="actual_ap_amount", attrName="actualApAmount", label="实收金额", comment="实收金额（人民币）"),
		@Column(name="remarik", attrName="remarik", label="备注"),
		@Column(name="ar_id", attrName="arId.arId", label="应收单ID"),
		@Column(name="row_number", attrName="rowNumber", label="服务订单行号"),
	}, joinTable = {
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = FixedExpense.class, attrName = "fixedExpense", alias = "b",
				on = "b.fixed_expense_id = a.expense_item", columns = {
				@Column(name = "fixed_expense_id", label = "项目费用id", isPK = true),
				@Column(name = "fixed_expense_name", label = "项目费用名称"),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Tcar.class, attrName = "car", alias = "c",
				on = "a.car_id = c.car_id", columns = {
				@Column(name = "car_id", label = "车辆id", isPK = true),
				@Column(name = "car_name", label = "车辆名称"),
		}),
}, orderBy="a.ar_detail_id ASC"
)
public class TarDetail extends DataEntity<TarDetail> {
	
	private static final long serialVersionUID = 1L;
	private String arDetailId;		// 应收单明细ID
	private String brand;		// 品牌
	private String area;		// 版型
	private String model;		// 车型
	private String carId;		// 车辆
	private String frameNumber;		// 车架号
	private String expenseItem;		// 费用项目
	private FixedExpense fixedExpense; //费用项目对象
	private Double apAmount;		// 应收金额（人民币）
	private Double actualApAmount;		// 实收金额（人民币）
	private String remarik;		// 备注
	private Tar arId;		// 应收单ID 父类
	private String arCode;   //临时字段，收款选择使用
    private Tcar car;
	private Long rowNumber;		// 服务订单行号
    private Double reiLeft;
	public Long getRowNumber() {
		return rowNumber;
	}

	public void setRowNumber(Long rowNumber) {
		this.rowNumber = rowNumber;
	}
	public Tcar getCar() {
		return car;
	}

	public void setCar(Tcar car) {
		this.car = car;
	}

	public Double getReiLeft() {
		return reiLeft;
	}

	public void setReiLeft(Double reiLeft) {
		this.reiLeft = reiLeft;
	}

	public FixedExpense getFixedExpense() {
		return fixedExpense;
	}

	public void setFixedExpense(FixedExpense fixedExpense) {
		this.fixedExpense = fixedExpense;
	}



	public TarDetail() {
		this(null);
	}

	public String getArCode() {
		return arCode;
	}

	public void setArCode(String arCode) {
		this.arCode = arCode;
	}

	public TarDetail(Tar arId){
		this.arId = arId;
	}
	
	public String getArDetailId() {
		return arDetailId;
	}

	public void setArDetailId(String arDetailId) {
		this.arDetailId = arDetailId;
	}
	
	@Length(min=0, max=2, message="品牌长度不能超过 2 个字符")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}
	
	@Length(min=0, max=64, message="版型长度不能超过 64 个字符")
	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}
	
	@Length(min=0, max=100, message="车型长度不能超过 100 个字符")
	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}
	
	@Length(min=0, max=64, message="车辆长度不能超过 64 个字符")
	public String getCarId() {
		return carId;
	}

	public void setCarId(String carId) {
		this.carId = carId;
	}
	
	@NotBlank(message="车架号不能为空")
	@Length(min=0, max=100, message="车架号长度不能超过 100 个字符")
	public String getFrameNumber() {
		return frameNumber;
	}

	public void setFrameNumber(String frameNumber) {
		this.frameNumber = frameNumber;
	}
	
	@NotBlank(message="费用项目不能为空")
	@Length(min=0, max=100, message="费用项目长度不能超过 100 个字符")
	public String getExpenseItem() {
		return expenseItem;
	}

	public void setExpenseItem(String expenseItem) {
		this.expenseItem = expenseItem;
	}
	
	@NotNull(message="应收金额不能为空")
	public Double getApAmount() {
		return apAmount;
	}

	public void setApAmount(Double apAmount) {
		this.apAmount = apAmount;
	}
	
	public Double getActualApAmount() {
		return actualApAmount;
	}

	public void setActualApAmount(Double actualApAmount) {
		this.actualApAmount = actualApAmount;
	}
	
	@Length(min=0, max=255, message="备注长度不能超过 255 个字符")
	public String getRemarik() {
		return remarik;
	}

	public void setRemarik(String remarik) {
		this.remarik = remarik;
	}
	
	public Tar getArId() {
		return arId;
	}

	public void setArId(Tar arId) {
		this.arId = arId;
	}
	
}